package com.app.biz.service.impl;

import java.util.List;

import com.app.common.core.domain.model.LoginUser;
import com.app.common.utils.DateUtils;
import com.app.common.utils.SecurityUtils;
import com.app.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.app.biz.mapper.BizAppInvestigateResultMapper;
import com.app.biz.domain.BizAppInvestigateResult;
import com.app.biz.service.IBizAppInvestigateResultService;

/**
 * 调查结果Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-09-09
 */
@Service
public class BizAppInvestigateResultServiceImpl implements IBizAppInvestigateResultService 
{
    @Autowired
    private BizAppInvestigateResultMapper bizAppInvestigateResultMapper;

    /**
     * 查询调查结果
     * 
     * @param baseId 调查结果主键
     * @return 调查结果
     */
    @Override
    public BizAppInvestigateResult selectBizAppInvestigateResultByBaseId(String baseId)
    {
        return bizAppInvestigateResultMapper.selectBizAppInvestigateResultByBaseId(baseId);
    }

    /**
     * 查询调查结果列表
     * 
     * @param bizAppInvestigateResult 调查结果
     * @return 调查结果
     */
    @Override
    public List<BizAppInvestigateResult> selectBizAppInvestigateResultList(BizAppInvestigateResult bizAppInvestigateResult)
    {
        return bizAppInvestigateResultMapper.selectBizAppInvestigateResultList(bizAppInvestigateResult);
    }

    /**
     * 新增调查结果
     * 
     * @param bizAppInvestigateResult 调查结果
     * @return 结果
     */
    @Override
    public int insertBizAppInvestigateResult(BizAppInvestigateResult bizAppInvestigateResult)
    {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        String username = loginUser != null ? loginUser.getUsername() : null;
        bizAppInvestigateResult.setBaseId(IdUtils.fastUUID());
        bizAppInvestigateResult.setCreateTime(DateUtils.getNowDate());
        bizAppInvestigateResult.setUpdateTime(DateUtils.getNowDate());
        bizAppInvestigateResult.setCreateBy(username);
        return bizAppInvestigateResultMapper.insertBizAppInvestigateResult(bizAppInvestigateResult);
    }

    /**
     * 修改调查结果
     * 
     * @param bizAppInvestigateResult 调查结果
     * @return 结果
     */
    @Override
    public int updateBizAppInvestigateResult(BizAppInvestigateResult bizAppInvestigateResult)
    {
        bizAppInvestigateResult.setUpdateTime(DateUtils.getNowDate());
        return bizAppInvestigateResultMapper.updateBizAppInvestigateResult(bizAppInvestigateResult);
    }

    /**
     * 批量删除调查结果
     * 
     * @param baseIds 需要删除的调查结果主键
     * @return 结果
     */
    @Override
    public int deleteBizAppInvestigateResultByBaseIds(String[] baseIds)
    {
        return bizAppInvestigateResultMapper.deleteBizAppInvestigateResultByBaseIds(baseIds);
    }

    /**
     * 删除调查结果信息
     * 
     * @param baseId 调查结果主键
     * @return 结果
     */
    @Override
    public int deleteBizAppInvestigateResultByBaseId(String baseId)
    {
        return bizAppInvestigateResultMapper.deleteBizAppInvestigateResultByBaseId(baseId);
    }
}
